package dianshiju

import org.slf4j.LoggerFactory
import us.codecraft.webmagic.ResultItems
import us.codecraft.webmagic.Task
import us.codecraft.webmagic.pipeline.Pipeline
import java.io.File

class FilePipeline() : Pipeline {
    val Log = LoggerFactory.getLogger(javaClass)
    val file = LoggerFactory.getLogger("fileLogger")
    override fun process(r: ResultItems, task: Task?) {
        val name:String? = r["name"]
        val tags:List<String>? = r["tags"]
        if(name != null && tags != null)
            file.info("$name\t${tags.joinToString(separator = ",")}")

    }

}